package com.remoter.basic.transport.support;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.remoter.basic.configure.IConfiguration;
import com.remoter.basic.configure.support.AbstractConfiguration;
import com.remoter.basic.consumer.IConsumer;
import com.remoter.basic.serialize.ISerialization;
import com.remoter.basic.transport.IClient;
import com.remoter.basic.util.Final;
import com.remoter.basic.util.ServiceLoader;

/**
 * @author			koko
 * @date 			2017-08-10 13:35:48
 * @description 	类功能说明
 */
public abstract class AbstractClient implements IClient{
	
	protected static final Logger logger = LoggerFactory.getLogger(AbstractServer.class);
	
	protected IConfiguration configuration;
	protected ISerialization serialization;
	protected IConsumer consumer;
	
	public AbstractClient(){
		this.configuration = AbstractConfiguration.getConfiguration();
		this.serialization = ServiceLoader.getService(ISerialization.class,this.configuration.getOption(Final.O_VAL_SERIALIZE));
		this.consumer = ServiceLoader.getService(IConsumer.class,this.configuration.getOption(Final.O_VAL_CONSUMER));
		logger.debug("use IConfiguration ["+configuration+"]");
		logger.debug("use ISerialization ["+serialization+"]");
		logger.debug("use IProvider ["+consumer+"]");
	}
	
}